1. Technical Field
The invention relates to an image processing method and an electronic apparatus using the same. Particularly, the invention relates to a white balance compensation method and an electronic apparatus using the same.
2. Related Art
Presently, cameras are widely used on mobile devices, and user's requirements on the quality of the captured images are getting higher and higher. Imaging quality of a camera depends on a size of a photo-sensing element and designs of a lens and an aperture. However, limited to a size of the mobile device, designs and quality of optical devices such as the photo-sensing element and the lens, etc. are limited. Therefore, when a post image signal processor (ISP) chip on the mobile device is designed, how to calibrate an exposure and a white balance, etc. of a raw image obtained by the photo-sensing element is an important issue to be developed.
A main purpose of the white balance of the camera is to restore a color temperature of a shooting scene at the moment when the image is captured, so as to restore the color of that moment. However, for the sake of design convenience of an algorithm and due to inadequate computation capability of the ISP chip, a calibration method of the white balance is to change a R:G:B (i.e. red:green:blue) ratio of a grey level and a white color etc. to be 1:1:1 (i.e. a grey world algorithm).
Under a normal light source (for example, the sunlight), the above method is probably applicable to a white balance calibration of the raw image. However, under a light source with a warm color such as a yellow light, etc., the R:G:B ratio of the white color is not 1:1:1, which is probably 1.2:1:0.8. In this case, if the R:G:B ratio of such scene is calibrated to 1:1:1, the white color is changed to pure white, and the other colors are biased to blue.
Besides, in order to calculate the R:G:B ratio, the ISP chip analyses the R:G:B ratio of each pixel of the image, and takes a reciprocal thereof as a RGB compensation value. For example, if the R:G:B ratio of one image is 0.5:1:0.2, the corresponding compensation value thereof is RGB=(2,1,5). Therefore, it is important to effectively obtain valid pixel information to perform the white balance calculation.
In the conventional white balance algorithm, the pixels of the whole image are obtained to perform the white balance calculation. When the raw image includes a large amount of pure color pixels or near pure color pixels, the conventional white balance algorithm probably misjudges the color temperature of the scene, such that the compensated image may have a problem of color distortion. For example, when the raw image includes a large amount of yellow objects or red objects, a red color (R) ratio of the raw image is higher than a blue color (B) ratio. Therefore, the conventional white balance algorithm probably misjudges the scene as a scene with a warm color temperature, and increases a compensation value corresponding to the blue color, which may result in a fact that the compensated image is biased to blue.